import pygetwindow as gw
import pyautogui as pyg

DNF_WD = gw.getWindowsWithTitle("Dungeon & Fighter")[0]

print(f"title:{DNF_WD}")
#290,352
left=DNF_WD.left
top=DNF_WD.top
width=DNF_WD.width
height=DNF_WD.height
INIT_WIDTH=800
INIT_HEIGHT=600
def compute_position(x_offset,y_offset):
    y= top+(INIT_HEIGHT/2+y_offset)*(height/INIT_HEIGHT)
    x= left+(INIT_WIDTH/2+x_offset)*(width/INIT_WIDTH)
    return (x,y)
#增幅按钮坐标
'''
(x,y)=compute_position(-110,55)
print(f"坐标为： ({x},{y})")
pyg.moveTo(x,y,duration=0.5)

# 装备位置485,300
(x,y)=compute_position(85,-10)
#y=top+(height/2-15)
#x=left + (width/2+110)
print(f"坐标为： ({x},{y})")
pyg.moveTo(x,y,duration=0.5)

#增幅确认位置：372,385
y=top+(height/2+85)
x=left + (width/2-30)
(x,y)=compute_position(-30,85)
print(f"坐标为： ({x},{y})")
pyg.moveTo(x,y,duration=0.5)


# 保护卷位置：372,355
y=top+(height/2+50)
x=left + (width/2-30)
(x,y)=compute_position(-30,50)
print(f"坐标为： ({x},{y})")
pyg.moveTo(x,y,duration=0.5)


# 失败确认 410 350
y=top+(height/2+30)
x=left + (width/2)
(x,y)=compute_position(0,30)
print(f"坐标为： ({x},{y})")
pyg.moveTo(x,y,duration=0.5)
'''
# 失败确认2 405,340
y=top+(height/2+40)
x=left + (width/2+5)
(x,y)=compute_position(5,40)
print(f"坐标为： ({x},{y})")
pyg.moveTo(x,y,duration=0.5)
